package kr.pfg.pfgTracer.view.statusbar
{
	import display.CTextField;
	import display.CTextFormat;
	import display.data.CTextFieldType;
	
	import flash.display.Sprite;

	public class VStatusBar extends Sprite
	{
		private var bg: Sprite;
		
		private var _txtMsg		: CTextField;
		private var _txtMemory : CTextField;
		
		public function VStatusBar()
		{
			this.init();
		}
		private function init(): void
		{
			bg = new Sprite();
			bg.graphics.beginFill( 0xFFFFFF, 0 );
			bg.graphics.drawRect( 0, 0, 10, 10 );
			bg.graphics.endFill();
			
			_txtMsg = new CTextField( CTextFieldType.BUTTON_TITLE );
			_txtMsg.defaultTextFormat = CTextFormat.getInstance().btnTitle;
			
			_txtMemory = new CTextField( CTextFieldType.BUTTON_TITLE );
			_txtMemory.defaultTextFormat = CTextFormat.getInstance().memory
			
			this.setPosition();
			this.initChild();
		}
		private function setPosition(): void
		{
			_txtMsg.x = 5;
			_txtMsg.y = 5;
			
			_txtMemory.x = bg.width - _txtMemory.width - 10;
			_txtMemory.y = 2;
		}
		private function initChild(): void
		{
			this.addChild( bg );
			this.addChild( _txtMsg );
			//this.addChild( _txtMemory );
		}
		
		override public function set width(value:Number):void
		{
			bg.width = value;
			_txtMsg.width = value - 50;
			this.setPosition();
		}
		override public function set height(value:Number):void
		{
			bg.height = value;
			this.setPosition();
		}
		
		public function set txtMsg( title: String ): void
		{
			_txtMsg.text = title;
			this.setPosition();
		}
		public function set txtMemory( title: String ): void
		{
			_txtMemory.text = title + "MB";
			this.setPosition();
		}
	}
}